<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:include page="./web/include/commonHeader.jsp"></jsp:include>
<link href="${pageContext.request.contextPath}/css/mix-login.css" rel="stylesheet">
<script type="text/javascript">
$(document).ready(function(){
	var msg = '${msg}';
	if(msg != '') {
		utils.showMsg(msg+"！");
	}
   clickImgCode();
   listenerFocus();
   $("#login-form").submit(function(){
		var username = $("#username").val();
		var password = $("#password").val();
		var code = $("#imgcode-input").val();
		if(utils.isEmpty(username)) {
			utils.showMsg("请输入用户名！");
			$("#username").focus();
			return false;
		} else if(utils.isEmpty(password)) {
			utils.showMsg("请输入密码！");
			$("#password").focus();
			return false;
		} else if(utils.isEmpty(code)) {
			utils.showMsg("请输入验证码！");
			$("#imgcode-input").focus();
			return false;
		}
		utils.waitLoading("正在登录...");
		return true;
	});
});

function clickImgCode() {
	  $("#imgcode").click(function(){
		  var num = parseInt(Math.random()*10000);
		  $(this).attr("src","captcha.do?num="+num);
	  });
}

function listenerFocus() {
	$("input[type=text],input[type=password]").focus(function(){
		$(".prompt-error").html("");
		var tag = $(this).attr("id");
		if(tag == 'imgcode-input') {
			$(this).removeClass("input-text-code");
			$(this).addClass("input-text-code-focus ");
		} else {
			$(this).removeClass("input-text");
			$(this).addClass("input-text-focus");
		}
	}).blur(function(){
		var tag = $(this).attr("id");
		if(tag == 'imgcode-input') {
			$(this).removeClass("input-text-code-focus");
			$(this).addClass("input-text-code");
		} else {
			$(this).removeClass("input-text-focus");
			$(this).addClass("input-text");
		}
	});
}
</script>
</head>

<body>
	<div class="full-header">
		<div class="navbar navbar-default navbar-static-top m-b-0" role="navigation">
			<div class="navbar-header">
				<strong><a class="navbar-brand" href="index.do"><h4>${project.name }</h4></a></strong>
			</div>
			<div class="navbar-collapse collapse"></div>
		</div><!-- navbar-default -->
	</div>
	<div class="login-wrap">
		<div class="container">
		  <div class="login-main">
		    <div class="login-main-content">
				<div class="login-title">
					<i class="fa fa-user fa-lg"></i> 用户登录
				</div>
				<div class="login-content">
					<form action="login.do" method="post" id="login-form">
						<div class="login-input">
							<label>用户名：</label>
							<input type="text" id="username" class="input-text" name="username" placeholder="请输入用户名"  value="admin" />
						</div>
						<div class="login-input">
							<label>密&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
							<input type="password" name="password" class="input-text" id="password" autocomplete="off" placeholder="请输入密码"  value="123456">
						</div>
						<div class="login-input">
							<label>验证码：</label>
							<input type="text" id="imgcode-input" name="imgCode" class="input-text-code" placeholder="请输入验证码" value=""> 
							<img alt="验证码" title="看不清，请点击刷新" id="imgcode" src="captcha.do" />
						</div>
						<div class="prompt-error p-t-5 p-l-20">${msg }</div>
						<div class="login-btn-wrap p-t-10">
							<div style="width: 100px;">
								<button type="submit" class="login-btn">登录</button>
							</div>
						</div>
					</form>
				</div>
			 </div><!-- end login-main-content -->
		   </div><!-- end login-main -->
	    </div><!-- container -->
	</div><!-- login-wrap -->
	<div class="footer clear">
		<div class="container-fluid text-center">
			<p>${project.copyright } &nbsp;&nbsp;${project.contactInfo }</p>
		</div>
	</div>
</body>
</html>
